import { Component } from 'react'
import { WrapWithAgeData, WrapWithNameData } from '../../decorate'
class UserInfo extends Component {
	static defaultProps = {
		name: '',
		age: '',
	}
	componentDidMount() {
		console.log(this.props)
		console.log('个人信息挂载成功')
	}
	render() {
		return (
			<div>
				<h3>装饰器模式选读</h3>
				<p>
					{' '}
					<span>姓名：</span>
					<span>{this.props.name}</span>{' '}
				</p>
				<p>
					{' '}
					<span>年龄：</span>
					<span>{this.props.age}</span>{' '}
				</p>
				<hr />
			</div>
		)
	}
}
UserInfo = WrapWithAgeData(UserInfo, '23')
UserInfo = WrapWithNameData(UserInfo, 'coderDGJ')

export default UserInfo
